import pymysql

# 1.下载pymysql，并且导入
# 2.建立数据库连接
conn = pymysql.connect(
    host='localhost', port=3306,
    user='root', password='1234567890',
    database='mysql', charset='utf8'
)
if conn:
    print("数据库连接成功")
else:
    print("数据库连接失败")

# 3.对数据表进行操作：查询
cursor = conn.cursor()
# 执行查询
sql = 'select * from user'
count = cursor.execute(sql)
print(f'查询到了{count}条数据')
result = cursor.fetchall()
print(result)
for i in result:
    print(f"{i[0]}:{i[1]}:{i[2]}")

# 4.释放资源
cursor.close()
conn.close()

# 单行注释
print(123456)
print("欢迎大家")

'''
1
1
1
'''